package DataAcces;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.sql.*;
import java.util.Properties;
import javax.swing.JOptionPane;

public class DBConecction {
    public static String Driver;
    public static String Url;
    public static String User;
    public static String Pass;
    public static Connection Connection;
    public static Statement Statement;

    public DBConecction(){}
    
    public static void DBConecction(){
        try{
            Properties pro = new Properties();
            pro.load(new FileInputStream("./sql.txt"));
            Driver = pro.getProperty("jdbcDriver");
            Url = pro.getProperty("jdbcUrl");
            User = pro.getProperty("jdbcUser");
            Pass = pro.getProperty("jdbcPassword");
            Connection = DriverManager.getConnection(Url, User, Pass);
            Statement=Connection.createStatement();
        } catch (Exception e){
                System.out.println(e);
                JOptionPane.showMessageDialog(null," ERROR \n "+e,"Error de Conexion",0);
                System.exit(0);
            }
        }
}
